const randomRange = (max: number, min: number): number => {
    return Math.random() * (max - min + 1) + min
}

const randomInt = (max: number, min: number): number => {
    return Math.floor(Math.random() * (max - min + 1) + min)
}

const randomDate = (min: Date, max?: Date): Date => {
    const time = randomInt(max ? max.getTime() : Date.now(), min.getTime())
    return new Date(new Date(0).getTime() + time)
}

const randomChineseName = (): string => {
    const firstName = '赵钱孙李周吴郑王冯陈褚卫蒋沈韩杨朱秦尤许何吕施张孔曹严华金魏陶姜戚谢邹喻柏'
    const begin = randomInt(firstName.length, 0)
    return firstName.substring(begin, begin + 1) + '**'
}

export { randomRange, randomInt, randomChineseName, randomDate }
